<?php 
if(KT!='KhiThe') exit;
class systems_model extends khithe_mysql
{	

	public function selectProduct($arrID)
	{	$strID = '';
		$arrRow ='';
		if(count($arrID)){
			foreach ($arrID as $valID){
				$strID .= " ID='".$valID."' OR";
			}
			$strID = substr($strID,0,-2);
			$select = "SELECT * FROM ".products." WHERE `Status`='true' AND ( ".$strID." )";
			$query = parent::SelectMySQL($select);
			
			while ($row = mysql_fetch_assoc($query)){
				$arrRow[] = $row; 	
			}
		}
		return $arrRow;
	}
	
	public function getComID($com='')
	{
		$com = parent::checkStrMySQL($com);
		$select = " SELECT * FROM ".components." WHERE ".components.".`Status`='true' AND ComDir='".$com."' ";
		$result = parent::SelectMySQL($select);
		$row = mysql_fetch_assoc($result);
		parent::CloseConnection();
		return $row['ID'];
	}
	public function getModule($com='',$position='')
	{
	
		$position = parent::checkStrMySQL($position);
		$ComID = $this->getComID($com);
		$select = "
				SELECT ".modules.".ModuleDir,  ".modules.".ModuleTitle  FROM ".modules_position.",".modules."
				WHERE ".modules_position.".ModuleID = ".modules.".ID  
				AND ".modules_position.".ComID = '".$ComID."'
				AND ".modules_position.".`Status` = 'true'
				AND ".modules.".`Status` = 'true'
				AND ".modules_position.".Position = '".$position."' ORDER BY `Order` ASC
		";
		$result= parent::SelectMySQL($select);
		parent::CloseConnection();
		return $result;
	
	}
	
	
	public function getAction($tblCom,$SeoKey)
	{
		$SeoKey = parent::checkStrMySQL($SeoKey);
		$tblCom = parent::checkStrMySQL($tblCom);
		$select = "SELECT * FROM ".prefix.$tblCom." WHERE SeoKey='".$SeoKey."' AND `Status` = 'true' ";
		$query = parent::SelectMySQL($select);
		$row = mysql_fetch_assoc($query);		
		return $row['Action'];
	}
	
	public function get_setting()
	{	
		$row_settings = array();
		
		$query_settings = "SELECT * FROM ".settings;
		$settings = parent::selectMySQL($query_settings);		
		return $settings;
	}
	
	public function getRates()
	{
		$select = "SELECT * FROM ".rates." WHERE `Status` = 'true' LIMIT 0,1 ";
		$query = parent::SelectMySQL($select);
		$row = mysql_fetch_assoc($query);		
		
		return $row;
	}
	
}
?>